package designpattern.demo.creational.singletonpattern;

/**
 * 使用枚举的单例模式
 */

public class SingletonEnum {
    private SingletonEnum() {
    }

    public static SingletonEnum getInstance() {
        return Singleton.INSTANCE.getInstance();

    }

    private static enum Singleton {

        INSTANCE;
        private SingletonEnum singleton;

        private Singleton() {
            singleton = new SingletonEnum();
        }

        public SingletonEnum getInstance() {
            return
                    singleton;

        }

    }


}
